package longcaisuyun.longcai.com.utils;

import android.os.CountDownTimer;
import android.widget.Button;

/**
 * Created by Administrator on 2016/6/16.
 */
public class MyTimeOut extends CountDownTimer{

    private Button button;
    public MyTimeOut(long millisInFuture, long countDownInterval,Button button) {
        super(millisInFuture, countDownInterval);
        this.button=button;
    }

    @Override
    public void onTick(long millisUntilFinished) {
        button.setClickable(false);
        button.setText("抢单"+"("+millisUntilFinished / 1000 + "s)");
    }

    /**
     * Callback fired when the time is up.
     */
    @Override
    public void onFinish() {
        button.setText("抢单");
        button.setClickable(true);
    }
}
